package Expe13;

/**
 * @Author 28021
 * @Date 2022/12/6
 */
class SortString{
    public static void sort(String a[]){
        int count = 0;
        for (int i = 0; i < a.length-1; i++) {
            for (int j = i+1; j <a.length ; j++) {
                if (a[j].compareTo(a[i])<0){
                    String temp = a[i];
                    a[i] = a[j];
                    a[j] = temp;
                }
            }
        }
    }
}
public class T5 {
    public static void main(String[] args) {
        String a[] = {"zxc","asd","qwe"};
        String b[] = {"张新成","阿斯顿","六芒星"};
        System.out.println("按字典序排列数组 a：");
        SortString.sort(a);
        for (int i = 0; i < a.length; i++) {
            System.out.print(" "+a[i]);
        }
        System.out.println("\n 按字典序排列数组 b：");
        SortString.sort(b);
        for (int i = 0; i < b.length; i++) {
            System.out.print(" "+b[i]);
        }
    }
}
